package com.legrand.www.module.exception.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

/**
 * @author xiah
 * 2018-06-26 05:40:46
 */
@RestControllerAdvice
public class ExceptionHander {
    @ExceptionHandler({Exception.class})
    public Map<String, Object> exception(Exception e) {
        Map<String, Object> map = new HashMap<>(16);
        map.put("ok", false);
        map.put("status", 0);
        map.put("case", e.getCause());
        map.put("message", e.getMessage());
        return map;
    }
}
